<div class="_main_cart">
    <div class="titlebar">
        <div class="title">购物车</div>
        <hr />
    </div>
    <!-- 商品列表 -->
    <table class="cart-list">
        {{#if user.cart_detail.length}}
        <thead class="head">
            <td></td>
            <td>商品名</td>
            <td>单价</td>
            <td>数量</td>
            <td>总计</td>
            <td>操作</td>
        </thead>
        {{#each user.cart_detail}} 
            {{#each goods_info}}
            <tr class="item">
                <td class="item1">
                    <img class="_cart_goods_img" bind-src="{{goods.preview_img_url}}?imageView/1/w/100/h/100">
                </td>
                <td class="item2">
                    <a href="#default/goods_details?id={{goods._id}}">
                        <p class="_cart_goods_name">{{goods.goods_name}}</p>
                    </a>
                </td>
                <td class="item3">
                    <span class="_cart_goods_one_price">￥{{goods.price}}</span>
                </td>
                <td class="item4">
                    <input type="number" class="_cart_goods_number" min=1 max="{{max_num}}" value="{{num}}" bind-input="{{'num'}}" event-change="{{'$Top.$Event.cart.update_cart_num'}}" />
                </td>
                <td class="item5">
                    <span class="_cart_goods_price">￥{{price}}</span>
                </td>
                <td class="item6">
                    <button event-click="{{'$Top.$Event.cart.remove_goods'}}" class="_delete_btn">删除</button>
                </td>
            </tr>
            {{/each}} 
        {{/each}}
        {{#else}}
        <p>购物车中暂无商品</p>
        {{/if}}
    </table>

    <div class="_main_cart_bottom">
        <div class="_add_codes">
            <div class="codetitle">输入优惠码</div>
            <div class="inputbox">
                <input type="text" class="code" />
            </div>
            <button class="_add_code_btn">确认</button>
        </div>

        <div class="count_price">
            <div class="_count_item">
                <div class="itemtitle">商品总价:</div>
                <div class="num">1150.00</div>
            </div>
            <div class="_count_item">
                <div class="itemtitle">运费:</div>
                <div class="num">+10.00</div>
            </div>
            <div class="_count_item">
                <div class="itemtitle">优惠:</div>
                <div class="num">-50.00</div>
            </div>
            <div class="_count_item">
                <div class="itemtitle">总计:</div>
                <div class="num">1110.00</div>
            </div>
            <div class="btnbox">
                <button class="count_btn">去结算</button>
            </div>
        </div>
    </div>
</div>

<!-- 商品列表 -->
<xmp type='tag' name='cart-list'>

    <!-- {{#each ${goods} }} -->
    <tr class="item">
        <td class="item1">
            <img class="_cart_goods_img" bind-src="{{goods.preview_img_url}}?imageView/1/w/100/h/100">
        </td>
        <td class="item2">
            <a href="#default/goods_details?id={{goods._id}}">
                <p class="_cart_goods_name">{{goods.goods_name}}</p>
            </a>
        </td>
        <td class="item3">
            <span class="_cart_goods_one_price">￥{{goods.price}}</span>
        </td>
        <td class="item4">
            <input type="number" class="_cart_goods_number" min=1 max="{{max_num}}" value="{{num}}" bind-input="{{'num'}}" event-change="{{'$Top.$Event.cart.update_cart_num'}}" />
        </td>
        <td class="item5">
            <span class="_cart_goods_price">￥{{price}}</span>
        </td>
        <td class="item6">
            <button event-click="{{'$Top.$Event.cart.remove_goods'}}" class="_delete_btn">删除</button>
        </td>
    </tr>
</xmp>
